<?php

// 将用户端与管理员端的视图分开, 主要目的是让用户端与管理员端使用不同的错误视图, 如, 不同的 404 视图;
// 注意:
// 在管理员端 controller 里的 view('auth.login'); 指向 resources/views/admin/auth/login 视图
// 在用户端 controller 里的 view('auth.login'); 指向 resources/views/web/auth/login 视图

$viewPathPrefix = 'web';
if (!app()->runningInConsole()) {
    $urlPathname = @parse_url(url()->current())['path'];

    if ($urlPathname == '/admin' || substr($urlPathname, 0, strlen('/admin/')) == '/admin/') {
        $viewPathPrefix = 'admin';
    }
}

return [

    /*
    |--------------------------------------------------------------------------
    | View Storage Paths
    |--------------------------------------------------------------------------
    |
    | Most templating systems load templates from disk. Here you may specify
    | an array of paths that should be checked for your views. Of course
    | the usual Laravel view path has already been registered for you.
    |
    */

    'paths' => [
        realpath(base_path('resources/views/' . $viewPathPrefix)),
    ],

    /*
    |--------------------------------------------------------------------------
    | Compiled View Path
    |--------------------------------------------------------------------------
    |
    | This option determines where all the compiled Blade templates will be
    | stored for your application. Typically, this is within the storage
    | directory. However, as usual, you are free to change this value.
    |
    */

    'compiled' => realpath(storage_path('framework/views/' . $viewPathPrefix)),

];
